﻿using System;
using DMS.BaseClass;
using DMS.Business.Utility;

namespace DMS.Web.Modules.SystemManagement
{
    public partial class SystemSettingForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.GetParams();

            if (!IsPostBack)
            {
                this.csSys.InitForm();
            }
        }

        private void GetParams()
        {
            if (!string.IsNullOrEmpty(Request["ConfigID"]))
            {
                this.csSys.ConfigID = Request["ConfigID"].ToString();
            }
        }

        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                this.csSys.Save();

                ClientHelper.Instance.CloseWindow("操作成功", string.Empty, RefreshType.OpenDialog);
            }
            catch (Exception ex)
            {
                string code = LogHelper.LogException(ex);
                string msg = string.Format("保存失败，请联系管理员。\\r\\n错误码：{0}", code);
                ClientHelper.Instance.Alert(msg);
            }
        }
    }
}